<template>
  <TyPlmButton  @click="clickFn">
  <slot></slot>
  </TyPlmButton>
</template>

<script setup>
import { debounce } from 'lodash';

import tyUi from '@common/ty-ui'
// // 引入 产品提供的 原始组件
console.log(tyRoot.core)

const { TyPlmButton } = tyUi.getExportResource('src/ty-ui/lib/ty-button/index.js');
//console.log('BaseButton: ', TyPlmButton);
// 在原组件的基础上 扩展additional属性
const props = defineProps({
  additional: {
    type: String,
    default: ''
  }
});
const emit = defineEmits(['click']);
// 重写原组件的click事件
const clickFn = debounce(
  () => {
    console.log(Date.now())
    emit('click', props.additional);
  },
  1000,
  {
    leading: false,
    trailing: true
  }
);
</script>

<style scoped></style>
